<%--
  Created by IntelliJ IDEA.
  User: 26354
  Date: 2021/4/20
  Time: 14:56
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ include file="/public/header/permissionCommon.jspf" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<head>
    <meta charset="utf-8">
    <title>新增派工订单</title>
    <c:set var="path" value="${pageContext.request.contextPath}"  scope="page"/>
    <style type="text/css">
        .layui-layout-body {
            overflow-x: auto;
            overflow-y: auto;
        }
        .layui-table-tips-main{display:none}
        .layui-table-tips-c{display:none}
        .layui-table-grid-down {display: none;}
        .laytable-cell-radio {
            padding-top:15px;
        }
        .layui-tree-txt{font-size:medium;}
        .layui-unselect.layui-form-checkbox{margin-top: 10px!important;}
        .layui-form-checkbox span{
            height:auto!important;
        }

        .images{
            position: absolute;left:25%;bottom:15%;;right:35%;
            filter:alpha(opacity=100);-moz-opacity:1.0;opacity: 1.0;z-index: 100;background-color: #ffffff
        }
    </style>
</head>
<body class="layui-layout-body">
<div class="layui-layout layui-layout-admin">
    <div class="layui-collapse" style="margin-left: 5px;margin-right: 5px;margin-top: 5px;margin-bottom: 5px">
        <%----------第一个折叠面板------------%>
        <div class="layui-colla-item" style="border-radius: 5px">
            <h2 class="layui-colla-title" style="background-color: #36a2f5;color: white;border-radius: 10px">机构信息</h2>
            <div class="layui-colla-content layui-show">
                <div class="myDepartment" id="myDepartment">
                    <form class="layui-form layui-form-pane" style="margin-top: 20px;margin-left: 10px;margin-right: 10px;">
                        <div class="layui-form-item">
                            <div class="layui-col-md4 ">
                                <label class="layui-form-label" >机构名称</label>
                                <div class="layui-input-block">
                                    <input type="text" name="department_name" id="department_name"  value="" class="layui-input" readonly="readonly">
                                </div>
                            </div>
                            <div class="layui-col-md4">
                                <label class="layui-form-label">联系方式</label>
                                <div class="layui-input-block">
                                    <input type="text" name="department_phone_number" id="department_phone_number" class="layui-input" readonly="readonly">
                                </div>
                            </div>
                            <div class="layui-col-md4">
                                <label class="layui-form-label">区内编码</label>
                                <div class="layui-input-block">
                                    <input type="text" name="department_region_code" id="department_region_code" class="layui-input" readonly="readonly">
                                </div>
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label">现在地址</label>
                            <div class="layui-input-block">
                                <input type="text" name="department_address" id="department_address" class="layui-input" readonly="readonly">
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <div class="layui-col-md4" >
                                <label class="layui-form-label" >结算代码</label>
                                <div class="layui-input-block">
                                    <input class="layui-input" type="text" name="department_settlement_code" id="department_settlement_code" readonly="readonly" >
                                </div>
                            </div>
                            <div class="layui-col-md4">
                                <label class="layui-form-label">结算范围</label>
                                <div class="layui-input-block">
                                    <input type="text" name="department_settlement_scope" id="department_settlement_scope" class="layui-input" readonly="readonly">
                                </div>
                            </div>
                            <div class="layui-col-md4">
                                <label class="layui-form-label">法人</label>
                                <div class="layui-input-block">
                                    <input type="text" name="department_corporate" id="department_corporate" class="layui-input" readonly="readonly">
                                </div>
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label" style="height: 75px;white-space:pre-line!important;">交易代码下发通知书日期</label>
                            <div class="layui-input-block">
                                <input style="height: 75px;" type="date" name="department_notification_date" id="department_notification_date" class="layui-input" readonly="readonly">
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label" style="height: 55px;white-space:pre-line!important;">首次可结算日期</label>
                            <div class="layui-input-block">
                                <input style="height: 55px;" type="date" name="department_first_settle_date" id="department_first_settle_date" class="layui-input" readonly="readonly">
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <div class="layui-col-xs6">
                                <label class="layui-form-label">创建时间</label>
                                <div class="layui-input-block">
                                    <input type="datetime-local" name="department_first_time" readonly="readonly" id="department_first_time" step="1" class="layui-input">
                                </div>
                            </div>
                            <div class="layui-col-xs6">
                                <label class="layui-form-label">修改时间</label>
                                <div class="layui-input-block">
                                    <input type="datetime-local" name="department_change_time" readonly="readonly" id="department_change_time" step="1" class="layui-input">
                                </div>
                            </div>
                        </div>
                    </form>
                </div>
            </div>
        </div>
        <%----------第二个折叠面板------------%>
        <div class="layui-colla-item">
            <h2 class="layui-colla-title" style="background-color: #36a2f5;color: white;border-radius: 10px">被照护人信息</h2>
            <div class="layui-colla-content layui-show">
                <%------------ 快速查找 -----------%>
                <div class="SearchElder">
                    老&nbsp&nbsp人&nbsp&nbsp姓&nbsp&nbsp名&nbsp：
                    <div class="layui-inline">
                        <input class="layui-input" name="elder_name" id="elder_name" autocomplete="off" style="height: 38px;width:150px;margin-right: 20px">
                    </div>
                    老&nbsp&nbsp人&nbsp&nbsp医&nbsp&nbsp保&nbsp&nbspID&nbsp&nbsp：&nbsp
                    <div class="layui-inline">
                        <input class="layui-input" name="elder_yb_id" id="elder_yb_id" autocomplete="off" style="height: 38px;width:150px;margin-right: 20px">
                    </div>
                    老 人 身 份 证 号 ：
                    <div class="layui-inline">
                        <input class="layui-input" name="elder_id" id="elder_id" autocomplete="off" style="height: 38px;width:150px;margin-right: 20px">
                    </div>
                    <div class="layui-inline" style="margin-left:5px;margin-right: 20px">
                        <button class="layui-btn" data-type="search" style="border-radius: 5px;width: 120px">
                            <i class="layui-icon layui-icon-search"></i>
                            <div class="layui-inline">快速查找</div>
                        </button>
                    </div>
                </div>
                <%------- 老人数据表格显示 --------%>
                <table class="layui-hide" id="elderArrangeList" lay-filter="elderArrange"></table>
                <div style="margin-left:5px;margin-top: 30px">
                    <div class="layui-inline" style="width: 10px;height: 40px;background-color: #1d94ff;margin-right: 15px"></div>
                    <div class="layui-inline" style="color: #1d94ff;font-weight: bold;font-size: large">被 照 护 人 信 息</div>
                </div>
                <%--自动显示选定后的老人信息--%>
                <div class="ArrangeElder">
                    <form class="layui-form" style="margin-top: 20px;margin-left: 5px;margin-right: 10px;">
                        <div class="layui-form-item">
                            <div class="layui-col-md4">
                                <label class="layui-form-label">姓名：</label>
                                <div class="layui-input-block">
                                    <input type="text" name="name" id="name" class="layui-input" readonly="readonly">
                                </div>
                            </div>
                            <div class="layui-col-md4">
                                <label class="layui-form-label">性别：</label>
                                <div class="layui-input-block">
                                    <input type="text" name="gender" id="gender" class="layui-input" readonly="readonly">
                                    <%--<div type="text" name="gender" id="gender" class="layui-input" readonly="readonly"></div>--%>

                                </div>
                            </div>
                            <div class="layui-col-md4">
                                <label class="layui-form-label">身份证号：</label>
                                <div class="layui-input-block">
                                    <input type="text" name="id_number" id="id_number" class="layui-input" readonly="readonly">
                                </div>
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <div class="layui-col-md4">
                                <label class="layui-form-label">年龄：</label>
                                <div class="layui-input-block">
                                    <input type="text" name="age" id="age" autocomplete="off"  class="layui-input" readonly="readonly">
                                </div>
                            </div>
                            <div class="layui-col-md4">
                                <label class="layui-form-label">社保卡号：</label>
                                <div class="layui-input-block">
                                    <input type="text" name="sbcard_id" id="sbcard_id" class="layui-input" readonly="readonly">
                                </div>
                            </div>
                            <div class="layui-col-md4">
                                <label class="layui-form-label">医保ID：</label>
                                <div class="layui-input-block">
                                    <input type="text" name="ybid" id="ybid" class="layui-input" readonly="readonly">
                                </div>
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <div class="layui-col-md4">
                                <label class="layui-form-label">等级：</label>
                                <div class="layui-input-block">
                                    <input type="text" name="person_level" id="person_level" class="layui-input" readonly="readonly">
                                </div>
                            </div>
                            <div class="layui-col-md4">
                                <label class="layui-form-label">人员性质：</label>
                                <div class="layui-input-block">
                                    <input type="text" name="person_catagory" id="person_catagory" class="layui-input" readonly="readonly">
                                </div>
                            </div>
                            <div class="layui-col-md4">
                                <label class="layui-form-label">评估类型</label>
                                <div class="layui-input-block">
                                    <input type="text" name="assess_type" id="assess_type" class="layui-input" readonly="readonly">
                                </div>
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <div class="layui-col-md4">
                                <label class="layui-form-label">联系方式：</label>
                                <div class="layui-input-block">
                                    <input type="text" name="phone_number" id="phone_number" class="layui-input" readonly="readonly">
                                </div>
                            </div>
                            <div class="layui-col-md4">
                                <label class="layui-form-label">联系人：</label>
                                <div class="layui-input-block">
                                    <input type="text" name="contact_people" id="contact_people" class="layui-input" readonly="readonly">
                                </div>
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <div class="layui-col-md4">
                                <label class="layui-form-label">待遇起始日</label>
                                <div class="layui-input-block">
                                    <input type="date" name="daiyu_start_date" id="daiyu_start_date" class="layui-input" readonly="readonly">
                                </div>
                            </div>
                            <div class="layui-col-md4">
                                <label class="layui-form-label">待遇到期日</label>
                                <div class="layui-input-block">
                                    <input type="date" name="daiyu_due_date" id="daiyu_due_date" class="layui-input" readonly="readonly">
                                </div>
                            </div>
                        </div>
                    </form>
                </div>
            </div>
        </div>
        <%----------第三个折叠面板------------%>
        <div class="layui-colla-item">
            <h2 class="layui-colla-title" style="background-color: #36a2f5;color: white;border-radius: 10px">服务内容</h2>
            <div class="layui-colla-content layui-show" style="height:500px">
                <div style="margin-left:5px;margin-top: 10px">
                    <div class="layui-inline" style="width: 10px;height: 40px;background-color: #1d94ff;margin-right: 15px"></div>
                    <div class="layui-inline" style="color: #1d94ff;font-weight: bold;font-size: large">选 择 服 务 内 容</div>
                </div>
                <%--------------穿梭框-----------%>
                <%--左框--%>
                <div class="layui-inline" style="margin-top:30px;margin-left:20%;width:350px;height:400px;border:2px solid #005cbf">
                    <div style="font-size: larger;margin-top:10px;margin-left: 125px;">待 选 服 务 项</div>
                    <hr class="layui-border-blue" style="height: 2px">
                    <div style="overflow: auto;width:340px;height:320px;margin-top:5px;margin-left: 10px;margin-right:10px">
                        <div id="leftTree" class="demo-tree"></div>
                    </div>
                </div>
                <%--按键--%>
                <div class="layui-inline">
                    <button class="layui-btn" id="toRight" lay-transfer="toRight" style="width:100px;height: auto;margin:20px">
                        <i class="layui-icon layui-icon-next"></i>
                    </button>
                    <br><br>
                    <button class="layui-btn" id="toLeft" lay-transfer="toLeft" style="width:100px;height: auto;margin: 20px">
                        <i class="layui-icon layui-icon-prev"></i>
                    </button>
                </div>
                <%--右框--%>
                <div class="layui-inline" style="margin-top:30px;margin-right:10%;width:350px;height:400px;border:2px solid #005cbf">
                    <div style="font-size: larger;margin-top:10px;margin-left: 125px;">已 选 服 务 项</div>
                    <hr class="layui-border-blue" style="height: 2px">
                    <div style="overflow: auto;width:340px;height:320px;margin-top:5px;margin-left: 10px;margin-right:10px">
                        <form class="layui-form" style="float: left">
                                <div class="layui-input-block" style="margin-left: 30px!important;">
                                    <div id="contentRight"></div>
                                </div>
                        </form>
                    </div>
                </div>

            </div>
        </div>
        <%------------- 提交按键 ------------%>
        <div style="text-align: center;margin-top: 10px">
            <hr class="layui-inline" style="height: 2px;color:#5e5e5e;width: 30%;">
            <div class="layui-inline" style="color: #5e5e5e;font-size: medium;margin: 10px">请确认以上信息无误</div>
            <hr class="layui-inline" style="height: 2px;color: #5e5e5e;width: 30%;">
        </div>
            <div id="form1"  enctype="multipart/form-data" style="font-weight: bold;font-size: medium"  >

                图片:<input type="file" name="file" id="file">
                <button onclick="saveImage()" class="layui-btn" style="align:center;margin-right:20px;margin-left:-75px;background-color: #1d94ff">
                    <div style="font-weight: bold;font-size: medium">上传图片</div>
                </button>
            <button id="Showimage" type="button" onclick="Showimage()" class="layui-btn" style="align:center;margin-left:400px;margin-top:-37px;background-color: #1d94ff;font-weight: bold;font-size: medium;display: block">预览</button>
            <button id="Showimage1" type="button" onclick="Showimage1()" class="layui-btn" style="align:center;margin-left:400px;margin-top:-37px;background-color: #1d94ff;font-weight: bold;font-size: medium;display: none">预览</button>
            </div>
        <div align="center" style="margin-top: 20px;margin-bottom: 20px">
            <button type="submit" class="layui-btn" lay-submit="" id="handin" lay-filter="handin" style="align:center;margin-right: 20px;background-color: #1d94ff">
                <div style="font-weight: bold;font-size: medium">提 交 订 单</div>
            </button>
        </div>
    </div>

    <div id="seeimage" class="images" style="display: none;" onclick="seeimage()">
        <a style="width:90px;height:100px;background-color: #0d19be" id="course-details"  ></a>
    </div>
    <%-------------表格确定框--------------%>
    <script type="text/html" id="Confirm">
        <a class="layui-btn layui-btn-xs" style="background-color: #e74c3c;color: white;margin-top: 5px;margin-left: 5px" lay-event="sure">确定</a>
    </script>
    <!------------ 新增派工单JS文件 ---------->
    <script type="text/javascript" src="${webPath}/js/arrangeInfo/addArrangeInfo.js"></script>
    <!------------ 老人信息表格 ---------->
    <script type="text/javascript" src="${webPath}/js/basicInfo/ElderInfo.js"></script>
    <script type="text/javascript" src="${webPath}/lib/jquery-3.3.1.min.js"></script>
    <script type="text/javascript" src="${webPath}/js/utils.js"></script>

</div>
</body>
<script>
    function Showimage(){
        $.ajax({
            type:"get",
            url:"${path}/arrangeInfo/showimage",
            dataType:'json',
            success:function(data){
                console.log("11111");
                console.log("pdf地址: " + data[0].pimage);
                var seeimage = document.getElementById("seeimage");
                var Showimage=document.getElementById("Showimage");
                var Showimage1=document.getElementById("Showimage1");
                seeimage.style.display="block";
                Showimage.style.display="none";
                Showimage1.style.display="block";
                var html = "";
                html+='<div id="newimage" style="height:280px;weight:180px ">';
                html += '<img  src="${path}/Image/image/';
                html += data[0].pimage;
                html += '" style=" filter:alpha(opacity=100);-moz-opacity:10.0;opacity: 10.0;z-index: 1001;height:380px;weight:80px">';
                html+='</div>';
                $("#course-details").append(html);
            }

        })
    }
    function seeimage() {
        var seeimage = document.getElementById("seeimage");
        seeimage.style.display="none";
    }
    function Showimage1() {
        var seeimage = document.getElementById("seeimage");
        if(seeimage.style.display=="block"){
            seeimage.style.display="none";
        }
        else{
            seeimage.style.display="block";
        }
    }
    function saveImage(){
        console.log("1111");
        var animateimg = $("#file").val(); //获取上传的图片名 带//
        var imgarr=animateimg.split('\\'); //分割
        var myimg=imgarr[imgarr.length-1]; //去掉 // 获取图片名
        var houzui = myimg.lastIndexOf('.'); //获取 . 出现的位置
        var ext = myimg.substring(houzui, myimg.length).toUpperCase();  //切割 . 获取文件后缀

        var file = $('#file').get(0).files[0]; //获取上传的文件
        // var fileSize = file.size;           //获取上传的文件大小
        // var maxSize = 104857600;              //最大1MB

        //console.log("fileSize:"+fileSize);
        if(ext !='.PNG' && ext !='.GIF' && ext !='.JPG' && ext !='.JPEG' && ext !='.BMP') {
            parent.layer.msg('文件类型错误,请上传图片类型');
            return false;
        }
        // else if(parseInt(fileSize) >= parseInt(maxSize)){
        //     parent.layer.msg('上传的文件不能超过100MB');
        //     return false;
        // }
        else{
            var f = document.getElementById('file').files[0];
            var data = new FormData();                  // 可以增加表单数据
            // 存入文件对象
            data.append("file",f);
            console.log("000000");
            $.ajax({
                url: "${path}/arrangeInfo/saveImage",
                type: 'POST',
                data: data,
                dataType: 'JSON',
                cache: false,
                processData: false,
                contentType: false
            }).done(function(ret){
                if(ret.msg=="ok"){
                   console.log("111111");
                    // $("#show").attr('value',+ ret['f'] +);
                    $("#form1").load(location.href+" #form1>*","");
                    $('#course-details').html("");
                    $('#newimage').html("");
                    alert('上传成功');
                }else{
                    parent.layer.msg('上传失败');
                }
            });
            return false;
        }
    }
</script>
</html>
